<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class Publisher extends Model
{
    use HasDateTimeFormatter;

    public function member()
    {
        return $this->hasOne(Member::class, 'open_id', 'open_id');
    }

    public function articles()
    {
        return $this->hasMany(Article::class, 'publish_id', 'id')->where('type', '=', 1)->orderByDesc('created_at');
    }
}
